package AlienArena::Server::Player;

use 5.006;
use strict;
use warnings;
our $VERSION = '0.01';


sub new {
    my $class = shift;
    my $self = bless {}, $class;
    my ($name, $ip) = @_;
    $self->name($name);
    $self->ip($ip);
    return $self;
}

sub name {
    my $self = shift;
    return $self->{'_name'} = shift if @_;
    return $self->{'_name'};
}

sub ip {
    my $self = shift;
    return $self->{'_ip'} = shift if @_;
    return $self->{'_ip'};
}

# runtime info
# these will be set by "private" setters

sub is_playing { shift->{_is_playing} }
sub score { shift->{_score} }

sub _is_playing {
    my $self = shift;
    return $self->{'_is_playing'} = shift if @_;
    return $self->{'_is_playing'};
}

sub _score {
    my $self = shift;
    return $self->{'_score'} = shift if @_;
    return $self->{'_score'};
}

=head1 NAME

AlienArena::Server::Player - Represents a player on an Alien Arena server

=head1 SYNOPSIS

    use AlienArena::Server::Player;

    $player = AlienArena::Server::Player->new('Xlub', '127.0.0.1');
    $name = $player->name;
    $ip = $player->ip;
    print $player->name," is playing\n" if ($player->is_playing);
    printf "Score : %d/n",$player->score;

=head1 METHODS

=head2 new($name, $ip)

=head2 name

=head2 ip

=head2 is_playing

=head2 score

=head1 AUTHOR

Mark A. Jensen, C<< <maj -at- fortinbras -dot- us> >>

=head1 LICENSE AND COPYRIGHT

Copyright 2012 Mark A. Jensen.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.


=cut

1; # End of AlienArena::Server::Player
